-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use npm instead of yarn to build Theia #14481
base: master
Are you sure you want to change the base?
Conversation
79e2f1c
to
43cf4ef
Compare
Fixes eclipse-theia#13948 Contributed on behalf of STMicroelectronics Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
due to eclipse-dash/dash-licenses#415 Signed-off-by: Thomas Mäder <[email protected]>
70c2767
to
82b7da0
Compare
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far it works very well.
I used npm ci
to install. I tested all applications and was able to build and start all of them. I also tested watching for the browser application. Tests also completed successfully.
Linting is currently broken but this is already mentioned in the current PR description.
@theia/request: > @theia/[email protected] lint
@theia/request: > theiaext lint
@theia/request: $ eslint --cache=true --no-error-on-unmatched-pattern=true "{src,test}/**/*.{ts,tsx}"
@theia/request: /bin/sh: 1: node: not found
@theia/request: Oops! Something went wrong! :(
@theia/request: ESLint: 8.57.1
@theia/request: SyntaxError: Failed to load plugin '@theia' declared in '.eslintrc.js » ../../configs/build.eslintrc.json » ./base.eslintrc.json': Unexpected end of JSON input
@theia/request: at JSON.parse (<anonymous>)
@theia/request: at PackageReExports.FromPackageSync (/home/user/git/theia/dev-packages/private-re-exports/lib/package-re-exports.js:127:47)
@theia/request: at Object.<anonymous> (/home/user/git/theia/dev-packages/private-eslint-plugin/rules/shared-dependencies.js:24:40)
@@ -1,7 +1,6 @@ | |||
root = true | |||
|
|||
[*] | |||
insert_final_newline = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep this? Why remove it?
yarn global add node-gyp | ||
yarn --skip-integrity-check --network-timeout 100000 | ||
npm install -g node-gyp | ||
npm install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use npm ci
instead of npm install
in all workflows to have a more deterministic pipeline. Using ci
will not update any dependencies and install them exactly as they are contained in the package-lock.json
await this.write(this.genConfigPath, this.compileWebpackConfig()); | ||
if (!this.pck.isBrowserOnly()) { | ||
await this.write(this.genNodeConfigPath, this.compileNodeWebpackConfig()); | ||
} | ||
if (await this.shouldGenerateUserWebpackConfig()) { | ||
await this.write(this.configPath, this.compileUserWebpackConfig()); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like accidental changes
@@ -23,4 +22,4 @@ | |||
"ext:test:watch": "mocha -w --config ../../configs/mocharc.yml \"./lib/**/*.*spec.js\"", | |||
"ext:test:clean": "rimraf .nyc_output coverage" | |||
} | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should keep the newline. I guess this change comes in via the changed .editorconfig
.
@@ -117,4 +115,4 @@ | |||
"ms-vscode.references-view", | |||
"ms-python.vscode-pylance" | |||
] | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here with the newline
"preinstall": "node-gyp install", | ||
"postinstall": "theia-patch", | ||
"prepare": "yarn -s compile:references && lerna run prepare && yarn -s compile", | ||
"postinstall": "theia-patch && npm run -s compute-references && lerna run afterInstall", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal preference
I would add the compile step here. I don't think there are many use cases where someone wants to run install
but not also compile all Typescript files.
"postinstall": "theia-patch && npm run -s compute-references && lerna run afterInstall", | |
"postinstall": "theia-patch && npm run -s compute-references && lerna run afterInstall && npm run compile", |
"performance:startup:electron": "yarn -s electron rebuild && cd scripts/performance && node electron-performance.js --name 'Electron Frontend Startup' --folder electron --runs 10", | ||
"performance:startup": "npm run -s performance:startup:browser && npm run -s performance:startup:electron", | ||
"performance:startup:browser": "concurrently --success first -k -r \"cd scripts/performance && node browser-performance.js --name 'Browser Frontend Startup' --folder browser --runs 10\" \"npm run -s --cwd examples/browser start\"", | ||
"performance:startup:electron": "npm run -s electron rebuild && cd scripts/performance && node electron-performance.js --name 'Electron Frontend Startup' --folder electron --runs 10", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to also have the watch scripts here, e.g. watch
, watch:browser
etc.
"publish:check": "node scripts/check-publish.js", | ||
"rebuild:clean": "rimraf .browser_modules", | ||
"test": "yarn -s test:theia && yarn -s electron test && yarn -s browser test", | ||
"rebuild:browser": "cd examples/browser && npm run rebuild", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we offer rebuild:browser
we should also offer rebuild:electron
"ts-clean": "theia-ts-clean.js" | ||
"run": "bin/theia-run.js", | ||
"theiaext": "bin/theia-ext.js", | ||
"ts-clean-dangling": "bin/theia-ts-clean.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this rename 👍
"publish:check": "node scripts/check-publish.js", | ||
"rebuild:clean": "rimraf .browser_modules", | ||
"test": "yarn -s test:theia && yarn -s electron test && yarn -s browser test", | ||
"rebuild:browser": "cd examples/browser && npm run rebuild", | ||
"start:browser": "cd examples/browser && npm run start", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start:browser-only
is missing
What it does
This PR rewrites the Theia build process to use npm in stead of yarn. This required a couple of changes:
Contrary to yarn, npm does not invoke the prepare scripts of workspace packages in the order of their dependencies (npm/cli#3034). So instead of relying on
yarn install
to invoke the necessary build scripts, we have to invoke the build process explicitly after thenpm install
. The build process is built on this logic:This can be achieved by invoking
npm run build
in the repo root.What's missing:
Fixes #13948
Contributed on behalf of STMicroelectronics
How to test
Make sure we can build Theia as described above and the apps work fine.
Follow-ups
Review checklist
Reminder for reviewers